package com.appspot.niehonglei.jdo;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.appspot.niehonglei.common.Tools;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Comment implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	
	@Persistent
	private Long indexId;
	
	@Persistent
	private String nickName;
	
	@Persistent
	private String email;
	
	@Persistent
	private String personalHomePage;
	
	@Persistent(serialized = "true", defaultFetchGroup = "true")
	private Text content;
	
	@Persistent
	private Date createDate;

	@Persistent
	private Date changeDate;
	
	@Persistent
	private String ifPublish;
	
	@Persistent
	private String ipAddress;

	public Comment(Long indexId, String nickName, String email, Text content,
			String ipAddress) {
		this.indexId = indexId;
		this.nickName = nickName;
		this.email = email;
		this.content = content;
		this.ipAddress = ipAddress;
		this.personalHomePage = "#";
		this.createDate = Tools.shiftDate(new Date());
		this.changeDate = Tools.shiftDate(new Date());
		this.ifPublish = "true";
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPersonalHomePage() {
		return personalHomePage;
	}

	public void setPersonalHomePage(String personalHomePage) {
		this.personalHomePage = personalHomePage;
	}

	public Text getContent() {
		return content;
	}

	public void setContent(Text content) {
		this.content = content;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getChangeDate() {
		return changeDate;
	}

	public void setChangeDate(Date changeDate) {
		this.changeDate = changeDate;
	}

	public String getIfPublish() {
		return ifPublish;
	}

	public void setIfPublish(String ifPublish) {
		this.ifPublish = ifPublish;
	}

	public Long getIndexId() {
		return indexId;
	}

	public void setIndexId(Long indexId) {
		this.indexId = indexId;
	}

	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}
	
	

}
